package com.hanamaki.struct;

public class While6 {

    public static void main(String[] args) {

        int num = 12345;  // 54321
        StringBuffer buffer = new StringBuffer();
        while (num != 0) {
            int r_right = num % 10;
            buffer.append(r_right);
            System.out.println(buffer.toString());
            num /= 10;
        }

        String string = buffer.toString();
        int i = Integer.parseInt(string);
        System.out.println(i);

    }
}
